import { onMounted } from 'vue';
import { useMainStore } from '@/store';
const mainStore = useMainStore();

// 微信授权
export default function useAuthorize(): void | string {
	const url =
		'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
		mainStore.appid +
		'&redirect_uri=' +
		mainStore.redirect_uri +
		'&response_type=code&scope=snsapi_userinfo&state=1&connect_redirect=1#wechat_redirect';
	console.log('useAuthorize',url);
	console.log('mainStore.userInfo',mainStore.userInfo);
	if (!mainStore.userInfo || mainStore.userInfo.head_img_url == null) {
		return (window.location.href = url);
	}
}
